﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Text;

namespace AccessCompare.Entities
{
    /// <summary>
    /// Class representing the Access Table
    /// </summary>
    public class Table
    {
        #region PROPERTIES

        /// <summary>
        /// Gets or sets th name of the Table
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the status of the table
        /// </summary>
        public Status TableStatus { get; set; }

        /// <summary>
        /// Gets or sets the table columns
        /// </summary>
        public List<Column> Columns { get; private set; }

        #endregion

        #region CONSTRUCTOR

        public Table()
        {
            Columns = new List<Column>();
        }

        #endregion

        #region PUBLIC PROPERTIES

        /// <summary>
        /// Adds new column in table
        /// </summary>
        /// <param name="column">Column that needs to be added</param>
        public void AddColumn(Column column)
        {
            Columns.Add(column);
        }

        /// <summary>
        /// Creates and adds new column into table
        /// </summary>
        /// <param name="columnName">The name of the column</param>
        /// <param name="columnType">OleDbType of the column</param>
        public void AddColumn(string columnName, OleDbType columnType)
        {
            Columns.Add(new Column(columnName, columnType));
        }

        #endregion
    }
}
